﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;

[assembly: CLSCompliant(true)]
namespace nb.development.csmediamanager
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (args.Length == 0) Application.Run(new Main());
            else if (!ProcessCommand(args))
            {
                if (args[0].ToLower() == "-upload")
                    Application.Run(new ShellAdd(new System.IO.FileInfo(args[1])));
                else if (args[0].ToLower() == "-uploaddirectory")
                    Application.Run(new ShellAdd(new System.IO.DirectoryInfo(args[1])));
            }
        }

        static bool ProcessCommand(string[] args)
        {
            if (args[0].ToLower() == "-register")
            {
                FileShellExtension.Register();
                MessageBox.Show("The shell extension was registered.", "Extension Registered");
                return true;
            }
            else if (args[0].ToLower() == "-unregister")
            {
                FileShellExtension.Unregister();
                MessageBox.Show("The shell extension was removed", "Extension Removed");

                return true;
            }
            return false;
        }
    }
}
